package com.dcy.znoa.domain.attendance;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.dcy.znoa.common.enums.OperTypeCode;
import com.dcy.znoa.common.enums.SexCode;
import com.dcy.znoa.domain.publiz.Company;
import com.dcy.znoa.domain.publiz.Department;
import com.dcy.znoa.domain.publiz.Duty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("att_rule")//考勤规则表
public class AttRule {

    @TableId(type = IdType.AUTO, value = "att_rule_id")
    Long attRuleId;//考勤规则ID
    /**
     * 考勤规则编号：一天有多次上下班时，考勤规则编号一样，序号不一样，序号从前到后
     一般是按照考勤规则编号这个字段来作为其他表的外键。
     数据的合理性放到前端页面去控制
     * */
    @TableField("att_rule_no")
    Integer attRuleNo;//规则编号

    @TableField("rule_name")
    String ruleName;//规则名称

    @TableField("rule_detail")
    String ruleDetail;//规则描述

    @TableField("att_rule_serial")
    Integer attRuleSerial;//考勤规则序号：从1开始

    @TableField("is_default")
    Integer isDefault;//默认0

    @TableField("comp_id")
    Long compId;

    @TableField("start_time")
    Date startTime;

    @TableField("end_time")
    Date endTime;

    @TableField("type")
    Integer type;//打卡类型：做特殊偷懒处理：1：移动打卡；2：硬件打卡；12：1+2

    @TableField("accuracy")
    Integer accuracy;//误差精度范围，单位为米，默认为500米

    @TableField("create_time")
    Date createTime;

    @TableField("create_man_id")
    Long createManId;

    @TableField("update_time")
    Date updateTime;

    @TableField("update_man_id")
    Long updateManId;

    @TableField("valid_flag")
    Integer validFlag;

    @TableField(exist = false)
    List<AttRuleAddress> attRuleAddressList;
    //以下三个字段作为临时存储时，多条以逗号分隔
    @TableField(exist = false)
    String longitude;//经度

    @TableField(exist = false)
    String latitude;//维度

    @TableField(exist = false)
    String address;//打卡地点

    @TableField(exist = false)
    Integer total;//规则关联人数


    public AttRule(Integer isDefault, Long compId) {
        this.isDefault = isDefault;
        this.compId = compId;
    }

    public AttRule(Integer attRuleNo, String ruleName, String ruleDetail, Integer attRuleSerial, Integer isDefault, Long compId, Date startTime, Date endTime, Integer type, Integer accuracy, Date createTime, Long createManId, Integer validFlag) {
        this.attRuleNo = attRuleNo;
        this.ruleName = ruleName;
        this.ruleDetail = ruleDetail;
        this.attRuleSerial = attRuleSerial;
        this.isDefault = isDefault;
        this.compId = compId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.type = type;
        this.accuracy = accuracy;
        this.createTime = createTime;
        this.createManId = createManId;
        this.validFlag = validFlag;
    }
}
